import { createStore } from 'vuex'

export default createStore({
  state: {
    isLogin: localStorage.getItem("token") ? true : false,
    token: localStorage.getItem("token") ? localStorage.getItem("token") : ""
  },
  mutations: {
    SET_TOKEN: (state, token) => {
      state.token = token
      localStorage.setItem("token", token)
      state.isLogin = true
    },
    REMOVE_TOKEN: (state) => {
      state.token = "",
      localStorage.removeItem("token")
      state.isLogin = false
    }
  },
  actions: {
  },
  modules: {
  }
})
